/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package autoUpdate;

import java.net.URL;
import java.util.concurrent.SynchronousQueue;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author paskud
 */
public class DownloadManager {

    private static SynchronousQueue<URL> _downloadQueue = new SynchronousQueue<URL>();
    private static long _queueLength = 0;

    public static void AddDownlaod(URL pathToTheResource) {
        try {
            _downloadQueue.put(pathToTheResource);
            _queueLength += 1;
            wakeupDownloadThread();
        } catch (InterruptedException ex) {
            Logger.getLogger(DownloadManager.class.getName()).log(Level.SEVERE, "Cannot add resource " + pathToTheResource.getPath() + " into the download queue.", ex);
        }
    }

    private static void wakeupDownloadThread() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    /**
     * @return the _queueLength
     */
    public static long getQueueLength() {
        return _queueLength;
    }

}
